package agentFramework.core;

public class Message 
{
	public final static int 	TYPE_ADMINISTRATIVE = 0;  // used only in game engine <-> agent communication
	public final static int		TYPE_COMMON = 1;		  // used mainly in inter-agent communication 
	
	public int 					senderID;
	public int 					receiverID;
	public String				content;
	public int 					type;
	
	
	// constructor
	public Message (int senderID, int receiverID, int type, String content) 
	{
		this.senderID = senderID;
		this.receiverID = receiverID;
		this.type = type;
		this.content = content;
	}
	
	
	// computes the message priority
	// if the priority is high, then the message will be inserted in the front of 
	// the receiver's message queue
	public boolean isHighPriority()
	{
		return false;
		//return (this.type == TYPE_ADMINISTRATIVE);
	}
	
	
	public String toString()
	{
		String msg = "";
		
		msg = "sender = " + senderID + "\n" +
			  "receiver = " + receiverID + "\n" +
			  "type = " + ((type == 0) ? "TYPE_ADMINISTRATIVE" : "TYPE_COMMON") + "\n" +
			  "content = " + content;
		
		return msg;
	}
	
	
	public Message clone()
	{
		return new Message(senderID, receiverID, type, content);
	}
}
